package com.glodon.paas.sdk;

import java.net.URI;

import javax.ws.rs.core.UriBuilder;

/**
 * host information for various PAAS services
 * @author guojf
 *
 */
public class EndpointConfig {
	private URI accountEndpointBase;
	private URI documentEndpointBase;
	
	public EndpointConfig(String host) {
		accountEndpointBase = UriBuilder.fromUri(host).path("account/api").build();
		documentEndpointBase = UriBuilder.fromUri(host).path("document/api").build();
	}
	
	public EndpointConfig(String accountHost, String documentHost) {
		accountEndpointBase = UriBuilder.fromUri(accountHost).path("account/api").build();
		documentEndpointBase = UriBuilder.fromUri(documentHost).path("document/api").build();
	}
	
	public URI getAccountEndpointBase() {
		return accountEndpointBase;
	}
	
	public void setAccountEndpointBase(URI accountEndpointBase) {
		this.accountEndpointBase = accountEndpointBase;
	}
	
	public URI getDocumentEndpointBase() {
		return documentEndpointBase;
	}
	
	public void setDocumentEndpointBase(URI documentEndpointBase) {
		this.documentEndpointBase = documentEndpointBase;
	}
	
	public URI accountEndpoint(String path) {
		return UriBuilder.fromUri(getAccountEndpointBase()).path(path).build();
	}
	
	public URI documentEndpoint(String path) {
		return UriBuilder.fromUri(getDocumentEndpointBase()).path(path).build();
	}
}
